package CModel

import (
	"database/sql/driver"
	"errors"
	"github.com/spf13/cast"
	"strings"
)

type MyStatus string

func (s MyStatus) Value() (driver.Value, error) {
	return s,nil
}
func (s *MyStatus) Scan(v interface{}) error {
	value, ok := v.([]byte)
	if ok {
		if ok :=  strings.Compare(cast.ToString(value),"1") ; ok == 0 {
			*s = "开启"
		}  else {
			*s = "关闭"
		}
		return nil
	}

	return errors.New("不匹配的数据类型")
}

